/*
 * @Descripttion: 
 * @Author: chenziming
 * @Date: 2023-03-16 10:54:41
 * @LastEditors: chenziming
 * @LastEditTime: 2023-03-16 10:55:09
 */
export const getSelectListMixin = {
  data() {
    return {
      //管理机构
      organizationList: [],
      //销售机构
      agentgroupList: [],
      //区部组
      groupDistrictList: [],
      //渠道
      saleChannelList: [],      
    }
  },
  mounted() {
    this.initial()
  },
  methods: {
    // 下拉框信息
    initial() {
      //管理机构
      this.apiB.selectamanagecom().then(res => {
        if (res.code == 200 && res.data != null) {
          this.organizationList = res.data;
        }
      });
      //销售机构
      this.apiB.selectagentgroup().then(res => {
        if (res.code == 200 && res.data != null) {
          this.agentgroupList = res.data;
        }
      });
      //渠道
      this.apiB.selectbranchtype().then(res => {
        if (res.code == 200 && res.data != null) {
          this.saleChannelList = res.data;
        }
      });
      this.getBranchmanager();
    },
    getBranchmanager(agentGroup, opts) {
      this.getBranchmanagerBefor &&
        this.getBranchmanagerBefor(agentGroup, opts);
      //区部组
      this.apiB.selectbranchmanager({
        agentGroup
      }).then((res) => {
        if (res.code == 200 && res.data != null) {
          this.getBranchmanagerAfter(res);
        }
      });
    },
    getBranchmanagerAfter(res) {
      this.groupDistrictList = res.data;
    },
    getBranchmanagerBefor(agentGroup, opts) {
      opts && this.$set(opts.obj || this.form, opts.fileByte || "branchmanager", "");
    },
  },
}
